﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace Fu3DEngine
{
  public   class VolumeData
    {



    }


 

  


  [Serializable]
  abstract public class CPBase
  {
      public CPBase(TerrainInfo help, Double rx, Double ry, Color col)
      {
          m_tHelper = help;
          x = rx;
          y = ry;
          z = m_tHelper.GetBaseHeight(rx, ry);
          sourcename = "";
          // hBToGround = 0;

          m_color = col;



      }

      ~CPBase()
      {

      }

      protected TerrainInfo m_tHelper;

      //下面是关于公共属性的定义
      //位置信息，数据内容是原始的
      public double x;
      public double y;
      public double z;

      public string sourcename;
      // public double hBToGround;//物体底面距离地面高度

      //颜色信息，rgb分量的代表
      public Color m_color;






  }
  [Serializable]
  public class CPCylinder : CPBase
  {

      public CPCylinder(TerrainInfo hp, Double x, Double y, Double radius, Double h, Color col)
          : base(hp, x, y, col)
      {
          this.radius = radius;
          height = m_tHelper.GetHeightFromMeter(h);

      }
      ~CPCylinder()
      {

      }


      //自己的属性
      public double radius;//圆半径
      public double height;//自身高度






  };

  [Serializable]
  public class CPSphere : CPBase
  {

      public CPSphere(TerrainInfo hp, Double x, Double y, Double radius, Color col)
          : base(hp, x, y, col)
      {
          this.radius = radius;


      }
      ~CPSphere()
      {

      }


      //自己的属性
      public double radius;//圆直径







  };




  [Serializable]
  public class CPPoly : CPBase
  {

      public CPPoly(TerrainInfo hp, Double h, Color col, DPoint[] pts)
          : base(hp, pts[0].x, pts[0].y, col)
      {
          m_points = new List<DPoint>();
          height = m_tHelper.GetHeightFromMeter(h);

          m_points.AddRange(pts);
      }

      ~CPPoly()
      {

      }





      public double height;

      public List<DPoint> m_points;











  };


  [Serializable]
  public class CPCube : CPBase
  {

      public CPCube(TerrainInfo hp, Double x, Double y, Double dx, double dy, double dz, Color col)
          : base(hp, x, y, col)
      {
          this.dx = dx;
          this.dy = dy;
          this.dz = m_tHelper.GetHeightFromMeter(dz);


      }
      ~CPCube()
      {

      }


      //自己的属性

      public double dx;
      public double dy;
      public double dz;






  };

  [Serializable]
  public class CPTubeLine : CPBase
  {

      public CPTubeLine(TerrainInfo hp, Double radius, int nSide, Color col, DPoint[] pts)
          : base(hp, pts[0].x, pts[0].y, col)
      {
          m_points = new List<TPoint>();


          for (int i = 0; i < pts.Length; i++)
          {
              double t = m_tHelper.GetBaseHeight(pts[i].x, pts[i].y);

              if (t > maxH)
              {
                  maxH = t;
              }

              if (t < minH)
              {
                  minH = t;
              }

              TPoint temp = new TPoint(pts[i].x, pts[i].y, t);

              m_points.Add(temp);


          }
          // m_points.AddRange(pts);

          numSides = nSide;
          this.radius = radius;




      }

      ~CPTubeLine()
      {

      }





      public double radius;

      public int numSides;

      public List<TPoint> m_points;

      public double minH = double.MaxValue;
      public double maxH = double.MinValue;










  };



  [Serializable]
  public class CPRoad : CPBase
  {

      public CPRoad(TerrainInfo hp, Double b1, double b2, double h, Color col, DPoint[] pts)
          : base(hp, pts[0].x, pts[0].y, col)
      {

          m_points = new List<TPoint>();


          for (int i = 0; i < pts.Length; i++)
          {
              double t = m_tHelper.GetBaseHeight(pts[i].x, pts[i].y);

              if (t > maxH)
              {
                  maxH = t;
              }

              if (t < minH)
              {
                  minH = t;
              }

              TPoint temp = new TPoint(pts[i].x, pts[i].y, t);

              m_points.Add(temp);


          }


          this.bt1 = b1;
          this.bt2 = b2;
          this.height = h;



      }

      ~CPRoad()
      {

      }



      public double bt1;
      public double bt2;
      public double height;


      public List<TPoint> m_points;

      public double minH = double.MaxValue;
      public double maxH = double.MinValue;





  };
}
